import type { ApiRequest } from '@/types/apis.d'
import type { TemplateItem } from '@/types/template/published'
import { request } from '../index'
export interface TemplateRequest {
  //模板管理
  'template.template_list': {
    name: string | undefined
    start_time: string | undefined
    publish_status?: number
    user_id?: string | undefined
    end_time: string | undefined
    offset: number
    limit: number
  }
  //获取模板 /v1/template/get
  'template.template_get': {
    id: string
  }
  //删除模板/v1/template/recycle/get_list
  'template.published_delete': {
    id: string
  }

  //回收站列表
  'template.recycle_list': {
    name: string | undefined
    offset: number
    limit: number
  }
  //回收站恢复模板
  'template.published_recover': {
    id: string
  }
  //回收站批量恢复模板
  'template.published_multiple_recover': {
    ids: string[]
  }
  //回收站删除模板
  'template.recycle_delete': {
    id: string
  }
  //回收站删除模板
  'template.published_multiple_delete': {
    ids: string[]
  }
  'template.published_create': {
    name: string | undefined
    style_name: string | undefined
    type: number | undefined
    video_site_id: string | undefined
    article_site_id: string | undefined
    picture_site_id: string | undefined
    adv_lib_id: string | undefined
    publish_status: number | undefined
  }
  'template.published_update': {
    id?: string | undefined
    name: string | undefined
    style_name: string | undefined
    type: number | undefined
    video_site_id: string | undefined
    article_site_id: string | undefined
    picture_site_id: string | undefined
    adv_lib_id: string | undefined
    publish_status: number | undefined
  }
}
//模板列表
export const template_list = (params?: ApiRequest['template.template_list']) =>
  request.get<'template.template_list', any[]>('v1/template/get_list', params)
//获取模板
export const template_get = (params?: ApiRequest['template.template_get']) =>
  request.get<'template.template_get', any[]>('v1/template/get', params)
//样式列表
export const template_get_style = () => request.get('v1/template/style/get_list')
//删除模板
export const published_delete = (data?: ApiRequest['template.published_delete']) =>
  request.post<'template.published_delete', any[]>('v1/template/delete', data)
//回收站列表
export const recycle_list = (params?: ApiRequest['template.recycle_list']) =>
  request.get<'template.recycle_list', any[]>('v1/template/recycle/get_list', params)
//回收站删除模板
export const recycle_delete = (data?: ApiRequest['template.recycle_delete']) =>
  request.post<'template.recycle_delete', any[]>('v1/template/recycle/delete', data)
//回收站恢复模板
export const published_recover = (data?: ApiRequest['template.published_recover']) =>
  request.post<'template.published_recover', any[]>('v1/template/recycle/recover', data)
//批量回收站删除模板
export const published_multiple_delete = (data?: ApiRequest['template.published_multiple_delete']) =>
  request.post<'template.published_multiple_delete', any[]>('v1/template/recycle/batch_delete', data)
//批量回收站恢复模板
export const published_multiple_recover = (data?: ApiRequest['template.published_multiple_recover']) =>
  request.post<'template.published_multiple_recover', any[]>('v1/template/recycle/batch_recover', data)
//创建模板
export const published_create = (data?: ApiRequest['template.published_create']) =>
  request.post<'template.published_create', any[]>('v1/template/create', data)
//更新模板
export const published_update = (data?: ApiRequest['template.published_update']) =>
  request.post<'template.published_update', any[]>('v1/template/update', data)
